<!--
 * @FileDescription 顶部栏
 * @Author lz
 * @Date 20230801 10:10:34
 * @LastEditors lz
 * @LastEditTime 20230801 10:10:34
-->
<template>
    <div class="wp_head">
        <img src="/images/Benz600/标题栏.png" class="hi_1">
        <img src="/images/Benz600/北方标副本.png" class="bf_ico">
        <div class="titleText">奔驰整车空间联动展示系统</div>
        <img src="/images/Benz600/ic_close.png" class="hi_close" @click="close">
    </div>
    <div v-if="HomeContent.Default.bigBox.value">
        <div class="leftMenu" v-if="HomeContent.Default.show.value">
            <img src="/public/images/Benz600/arrow3.png" class="hidden1" @click="hidden">
            <div class="right" style="width: 150px;">
                <el-form-item label="发动机系统" class="enginePic">
                    <el-switch v-model="HomeContent.Default.engine.value" @click="engineSystem" />
                </el-form-item>
                <el-form-item label="灯光系统" class="lamplightPic">
                    <el-switch v-model="HomeContent.Default.lamplight.value" @click="lamplightSystem" class="switch" />
                </el-form-item>
            </div>
        </div>
        <img src="/public/images/Benz600/arrow3.png" class="hidden2" v-else @click="showBox">
    </div>
</template>

<script setup lang="ts">
import HomeContent from '../HomeContent';
import { ClientMessage } from '@runtime/generate/message/ClientMessage';
import WebSocketComponent from '@runtime/module/WebSocket/WebSocketComponent';
import MessageCode from '../MessageCode';
import { ref } from 'vue';

function close() {
    WebSocketComponent.Default.PostMessage(new ClientMessage.DiagnosisAdapterMessage(MessageCode.Default.MsgCodesList.SYSTEM_QUIT))
    //关闭
    WebSocketComponent.Default.PostMessage(new ClientMessage.ShutdownMessage());
}
async function engineSystem() {
    if (HomeContent.Default.engine.value) {
        await WebSocketComponent.Default.PostMessage(new ClientMessage.DiagnosisAdapterMessage(MessageCode.Default.MsgCodesList.DISASSEMBLY_OBJECT_RELAY_ENGINE, '1'))
    } else {
        await WebSocketComponent.Default.PostMessage(new ClientMessage.DiagnosisAdapterMessage(MessageCode.Default.MsgCodesList.DISASSEMBLY_OBJECT_RELAY_ENGINE, '0'))
    }
}
async function lamplightSystem() {
    if (HomeContent.Default.lamplight.value) {
        await WebSocketComponent.Default.PostMessage(new ClientMessage.DiagnosisAdapterMessage(MessageCode.Default.MsgCodesList.DISASSEMBLY_OBJECT_RELAY_LAMPLIGHT, '1'))
    } else {
        await WebSocketComponent.Default.PostMessage(new ClientMessage.DiagnosisAdapterMessage(MessageCode.Default.MsgCodesList.DISASSEMBLY_OBJECT_RELAY_LAMPLIGHT, '0'))
    }
}
function hidden() {
    HomeContent.Default.show.value = false
}
function showBox() {
    HomeContent.Default.show.value = true
}
</script>

<style scoped>
.hidden1 {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(0, -50%);
    margin-left: 13px;
}
.hidden2 {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(0, -50%) rotate(180deg);
    margin-left: 13px;
}

.leftMenu {
    width: 280px;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(0, -50%);
    background-image: url('/images/Benz600/黑色渐变遮罩.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
    z-index: 1;
    border: 1px solid #3ddbfc;
    padding-top: 20px;
}

.enginePic {
    width: 220px;
    height: 59px;
    background-image: url('/images/Benz600/btn_bg.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
    color: #fff;
    margin-left: 50px;
    font-size: 19px;
    padding: 13px 24px;
}
::v-deep .enginePic .el-form-item__label{
  color: #fff;
}

.lamplightPic {
    width: 220px;
    height: 59px;
    background-image: url('/images/Benz600/btn_bg.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
    color: #fff;
    margin-left: 50px;
    font-size: 19px;
    padding: 13px 24px;
}
::v-deep .lamplightPic .el-form-item__label{
  color: #fff;
}

.switch {
    margin-left: 19px;
}

.wp_head {
    width: 100%;
    height: 77px;
    position: relative;
}

.hi_1 {
    /* height: 77px; */
    height: 120px;
    position: absolute;
    left: -524px;
}

.hi_close {
    width: 50px;
    position: absolute;
    right: 15px;
    top: 35px;
    transition: all 0.2s linear;
}

.hi_close:hover {
    transform: rotate(180deg);
    transition: all 0.2s linear;
}

.bf_ico {
    /* width: 39px;
    position: absolute;
    left: 740px;
    top: 10px; */
    width: 65px;
    position: absolute;
    left: 617px;
    top: 18px;
}

.titleText {
    position: absolute;
    /* left: 800px;
    top: 4px;
    font-size: 30px; */
    left: 700px;
    top: 7px;
    font-size: 50px;
    color: #FFFFFF;
}
#el-id-9820-0 {
    color: #fff;
}
</style>